﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MessageDetails.ascx.cs" Inherits="TeamTime.MessageDetails" %>
<asp:TextBox ID="txtCompanyID" runat="server" Visible="false"></asp:TextBox>
<asp:CheckBox ID="chkSuccessfullySaved" runat="server" Visible="false"></asp:CheckBox>
<asp:Panel runat="server" ID="pnlDetails" SkinID="PopupPanel" DefaultButton="btnSave"
    Width="" Height="">
    <table cellspacing="0" width="">
        <tr id="trID" runat="server" visible="false">
            <td>
                ID
            </td>
            <td>
                <asp:TextBox ID="txtID" runat="server" ReadOnly="true" BackColor="#E0E0E0" BorderStyle="None"></asp:TextBox>&nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Project
            </td>
            <td>
                <asp:DropDownList ID="ddlProjectID" runat="server" Enabled="false">
                </asp:DropDownList>
                <asp:LinkButton ID="lnkLoadDup" runat="server" OnClick="lnkLoadDup_Click" Visible="False">This task already exists.  Click to Load.</asp:LinkButton>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Task Name
            </td>
            <td>
                <asp:TextBox ID="txtTaskName" runat="server" Width="350px" MaxLength="200" ReadOnly="true"></asp:TextBox>
                 
            </td>
            <td>
                <asp:RequiredFieldValidator ID="reqValTaskName" runat="server" Display="Dynamic"
                    ErrorMessage="* Required" ValidationGroup="addform" ControlToValidate="txtTaskName"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td>
                Allocated To
            </td>
            <td>
                <asp:DropDownList ID="ddlStaffMemberIDAllocatedTo" runat="server" Enabled="false">
                </asp:DropDownList>
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Description
            </td>
            <td>
                <asp:TextBox ID="txtDescription" runat="server" Width="480px" MaxLength="1000" ReadOnly="true"
                    TextMode="MultiLine" Rows="10"></asp:TextBox>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Creation Date
            </td>
            <td>
                <clib:TextBoxCalendar ID="calCreationDate" runat="server" ClearText="" DateFormat="yyyy/MM/dd"
                    ReadOnly="false" Required="True" Text="" Width="80px" EnableViewState="true"
                    ErrorMessage="* Required" ValidationGroup="addform">
                </clib:TextBoxCalendar>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Disabled
            </td>
            <td>
                <asp:CheckBox ID="chkDisabled" runat="server" readonly="true"></asp:CheckBox>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Estimated Hours
            </td>
            <td>
                <asp:TextBox ID="txtEstimatedHours" runat="server" Width="27px" MaxLength="9" ReadOnly="false"></asp:TextBox><asp:RequiredFieldValidator
                    ID="reqValEstimatedHours" runat="server" Display="Dynamic" ErrorMessage="* Required"
                    ValidationGroup="addform" ControlToValidate="txtEstimatedHours"></asp:RequiredFieldValidator>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Completion Date
            </td>
            <td>
                <clib:TextBoxCalendar ID="calCompletionDate" runat="server" ClearText="" DateFormat="yyyy/MM/dd"
                    ReadOnly="false" Required="False" Text="" Width="80px" EnableViewState="true">
                </clib:TextBoxCalendar>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                Cust Ref No.
            </td>
            <td>
                <asp:TextBox ID="txtCustomerRefNumber" runat="server" Width="150px" MaxLength="50"
                    ReadOnly="true"></asp:TextBox>
            </td>
            <td>
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td>
                URL
            </td>
            <td colspan="3">
                <asp:TextBox ID="txtURL" runat="server" Width="150px" MaxLength="255" ReadOnly="true"></asp:TextBox>
                <asp:HyperLink ID="hypURL" runat="server" Target="_blank" ></asp:HyperLink>
                <asp:Label ID ="lblURL" runat="server" Text="......E.g...http://www.google.co.za"></asp:Label>
            </td>
        </tr>
        <tr id="trSaveButton" runat="server">
            <td colspan="2" align="center" style="text-align: right"><uc1:LabelWithTimedMsg ID="lblSaveMessage" runat="server" />
                <asp:Button ID="btnSave" runat="server" Text="Save" ValidationGroup="addform" OnClick="btnSave_Click"
                    UseSubmitBehavior="true" />
                    <asp:LinkButton ID="lnkAddTime" runat="server" CausesValidation="true" Visible="false" ValidationGroup="addform" 
                                Text="Add a time entry" OnClick="lnkAddTime_Click" ></asp:LinkButton>
                
            </td>
        </tr>
        <tr id="trModif" runat="server" visible="true">
            <td colspan="2">
                Modified By&nbsp;
                <asp:TextBox ID="txtUserNameModifiedBy" runat="server" Width="137px" MaxLength="4"
                    ReadOnly="true" BackColor="#E0E0E0" BorderStyle="None"></asp:TextBox>
                On
                <asp:TextBox ID="txtRecordDate" runat="server" Width="62px" MaxLength="10" ReadOnly="true"
                    BackColor="#E0E0E0" BorderStyle="None"></asp:TextBox>&nbsp;
            </td>
        </tr>
        <tr>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" SkinID="GridView"
                AllowPaging="True" PageSize="5" AllowSorting="True" DataKeyNames="ID" OnPageIndexChanging="GridView1_PageIndexChanging"
                OnRowCommand="GridView1_RowCommand">
                <Columns>
                    <asp:TemplateField HeaderText="" SortExpression="ID">
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkID" runat="server" CausesValidation="false" CommandName="Select"
                                Text="Edit" CommandArgument='<%# DataBinder.Eval(Container, "DataItem.ID") %>'></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="StartDate" HeaderText="Start" SortExpression="StartDateTime"
                        DataFormatString="{0:yyyy/MM/dd}" HtmlEncode="false"></asp:BoundField>
                    <asp:BoundField DataField="StartTime" HeaderText="Start Time" SortExpression="StartTime">
                    </asp:BoundField>
                    <asp:BoundField DataField="EndDate" Visible="False " HeaderText="End" SortExpression="EndDate"
                        DataFormatString="{0:yyyy/MM/dd}" HtmlEncode="false"></asp:BoundField>
                    <asp:BoundField DataField="EndTime" HeaderText="End Time" SortExpression="EndTime">
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="" SortExpression="ID">
                        <HeaderTemplate>
                            Total Hours<br />
                            <asp:Label ID="lblTotalHours" runat="server" Width="65px" ReadOnly="true" Style="direction: rtl;
                                font-weight: bold;"></asp:Label>
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label ID="lblHours" runat="server" Text='<%# formatNum(DataBinder.Eval(Container, "DataItem.Duration") )%>'
                                MaxLength="9" Width="59px" ReadOnly="true" Style="direction: rtl;"></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="CompanyProject" HeaderText="Project" SortExpression="CompanyProject">
                    </asp:BoundField>
                    <asp:BoundField DataField="TimeEntryDescriptionShort" HeaderText="Description" SortExpression="TimeEntryDescriptionShort">
                    </asp:BoundField>
                    <asp:BoundField DataField="FullNameAndID" HeaderText="Person" SortExpression="FullNameAndID">
                    </asp:BoundField>
                    
                </Columns>
                 <EmptyDataTemplate>
                    No time entries found</EmptyDataTemplate>
                <PagerTemplate>
                    <table width="100%">
                        <tr>
                            <td style="text-align: left; font-size: 11px; width: 100px;">
                                Page
                                <asp:Label ID="lblPageIndex" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1  %>' />
                                of
                                <asp:Label ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount  %>' />
                            </td>
                            <td style="text-align: center; font-size: 11px;">
                                <asp:Panel ID="pnlPager" runat="server" DefaultButton="lnkGo">
                                    <asp:LinkButton ID="lnkFirst" runat="server" CausesValidation="False" CommandArgument="First"
                                        CommandName="Page" Text="Page 1" />&nbsp;&nbsp;
                                    <asp:LinkButton ID="lnkPrev" runat="server" CausesValidation="False" CommandArgument="Prev"
                                        CommandName="Page" Text="<< Prev" />&nbsp;&nbsp;
                                    <asp:LinkButton ID="lnkNext" runat="server" CausesValidation="False" CommandArgument="Next"
                                        CommandName="Page" Text="Next >>" />&nbsp;&nbsp;
                                    <asp:LinkButton ID="lnkLast" runat="server" CausesValidation="False" CommandArgument="Last"
                                        CommandName="Page" Text='<%# "Page "+ ((GridView)Container.Parent.Parent).PageCount  %>' />&nbsp;&nbsp;&nbsp;
                                    <asp:TextBox ID="txtNewPageIndex" runat="server" Width="20px" Text='<%# ((GridView)Container.Parent.Parent).PageIndex + 1  %>' />
                                    <asp:LinkButton ID="lnkGo" runat="server" CausesValidation="False" CommandArgument="-1"
                                        CommandName="Page" Text="Go" /><!-- here set the CommandArgument of the Go Button to '-1' as the flag -->
                                </asp:Panel>
                            </td>
                        </tr>
                    </table>
                </PagerTemplate>
            </asp:GridView>
        </tr>
    </table>
</asp:Panel>